package com.lx.patterns.singleton.demo4;

/**
 * @ClassName Singleton
 * @Description: //懒汉式-双重检查锁
 * @Author: 落雪
 * @CreateDate: 2025/1/12 16:56
 * @UpdateUser: 落雪
 * @UpdateDate: 2025/1/12 16:56
 * @UpdateRemark:
 * @Version: 1.0
 */

public class Singleton {

    private volatile static Singleton instance;

    private Singleton(){};



    public static  Singleton getInstance(){

        if(instance==null){
            synchronized (Singleton.class){
                instance = new Singleton();
            }
        }
        return instance;
    }

}